﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Popup.Master" CodeBehind="MRPList.aspx.cs"
    Inherits="VSM.MRPList" EnableEventValidation="false" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript" src="Scripts/1.8.3.jquery.min.js"></script>
    <script type="text/javascript">
        $("[src*=plus]").live("click", function () {
            $(this).closest("tr").after("<tr><td></td><td colspan = '999'>" + $(this).next().html() + "</td></tr>")
            $(this).attr("src", "images/minus.png");
        });
        $("[src*=minus]").live("click", function () {
            $(this).attr("src", "images/plus.png");
            $(this).closest("tr").next().remove();
        });
    </script>
    <div>
        <asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <div style="height: 525px; overflow: scroll">
                    <table id="Table1" width="100%" style="font-weight: bold">
                        <tr>
                            <td class="FormLineItemAlt" valign="middle">
                                From Run. Date
                            </td>
                            <td class="FormLineItemAlt" valign="middle">
                                <asp:TextBox ID="txtFromDocDate" Width="100px" runat="server"></asp:TextBox>
                                <cc1:CalendarExtender ID="txtFromDocDate_CalendarExtender" runat="server" Format="dd/MM/yyyy"
                                    PopupButtonID="imgFromDocDate" TargetControlID="txtFromDocDate">
                                </cc1:CalendarExtender>
                                <asp:ImageButton ID="imgFromDocDate" runat="Server" AlternateText="Click to show calendar"
                                    ImageUrl="~/Images/Calendar_scheduleHS.png" />
                            </td>
                            <td class="FormLineItemAlt" valign="middle">
                                To Run. Date
                            </td>
                            <td class="FormLineItemAlt" valign="middle">
                                <asp:TextBox ID="txtToDocDate" runat="server" Width="100px"></asp:TextBox>
                                <cc1:CalendarExtender ID="txtToDocDate_CalendarExtender" runat="server" Format="dd/MM/yyyy"
                                    PopupButtonID="imgToDocDate" TargetControlID="txtToDocDate">
                                </cc1:CalendarExtender>
                                <asp:ImageButton ID="imgToDocDate" runat="Server" AlternateText="Click to show calendar"
                                    ImageUrl="~/Images/Calendar_scheduleHS.png" />
                            </td>
                        </tr>
                        <tr>
                            <td class="FormLineItem" valign="middle">
                                ForeCast Code
                            </td>
                            <td class="FormLineItem" valign="middle">
                                <asp:TextBox ID="txtRemark" Width="100px" runat="server"></asp:TextBox>
                            </td>
                            <td class="FormLineItem" valign="middle">
                                Scenario Code
                            </td>
                            <td class="FormLineItem" valign="middle">
                                <asp:TextBox ID="txtSName" runat="server" Width="100px"></asp:TextBox>
                                <asp:Button ID="btnSearch" runat="server" OnClick="btnSearch_Click" Style="background-image: url('/Images/bgButton.png');
                                    background-repeat: no-repeat;" Text="Search" Width="80px" />
                            </td>
                        </tr>
                    </table>
                    <table style="width: 100%; border: 1px;" cellpadding="3" cellspacing="0">
                        <tr>
                            <td colspan="2" style="text-align: center;">
                                <asp:GridView ID="grdBP" runat="server" CssClass="GridInner" Width="100%" BorderColor="White"
                                    BackColor="White" AutoGenerateColumns="False" CellPadding="2" HeaderStyle-Height="27px"
                                    OnRowDataBound="grdBP_RowDataBound" AllowPaging="True" OnPageIndexChanging="grdBP_PageIndexChanging"
                                    PageSize="20" DataKeyNames="Id">
                                    <RowStyle BackColor="#D9E0ED" ForeColor="Black" BorderColor="White" BorderWidth="2px"
                                        Height="25px" />
                                    <AlternatingRowStyle BackColor="#EEF1F7" BorderColor="White" BorderWidth="2px" Height="25px" />
                                    <Columns>
                                        <asp:TemplateField>
                                            <ItemTemplate>
                                                <img alt="" style="cursor: pointer" src="images/plus.png" width="20px" />
                                                <asp:Panel ID="pnlOrders" runat="server" Style="display: none">
                                                    <asp:GridView ID="gvOrders" CssClass="GridInner" runat="server" Width="100%" BorderColor="White"
                                                        BackColor="White" AutoGenerateColumns="False" CellPadding="2" HeaderStyle-Height="27px"
                                                        CellSpacing="2" HeaderStyle-VerticalAlign="Middle" OnRowDataBound="gvOrder_RowDataBound">
                                                        <PagerSettings Mode="NumericFirstLast" />
                                                        <PagerStyle BackColor="#70A0D0" Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" />
                                                        <RowStyle BackColor="#D9E0ED" BorderColor="White" BorderWidth="2px" Height="25px" />
                                                        <AlternatingRowStyle BackColor="#EEF1F7" BorderColor="White" BorderWidth="2px" />
                                                        <Columns>
                                                            <asp:TemplateField HeaderText="Model">
                                                                <ItemStyle HorizontalAlign="Center" Width="100px" />
                                                                <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblItemCode" runat="server" Text='<%# Bind("ModelName") %>' BorderStyle="none"></asp:Label>
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Product">
                                                                <ItemStyle HorizontalAlign="left" Width="200px" />
                                                                <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblItemName" runat="server" Text='<%# Bind("ProductName") %>' BorderStyle="none" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Vendor Code">
                                                                <ItemStyle HorizontalAlign="Center" Width="100px" />
                                                                <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblVendorCode" runat="server" Text='<%# Bind("VendorCode") %>' BorderStyle="none" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="FC">
                                                                <ItemStyle HorizontalAlign="Center" Width="80px" />
                                                                <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblFC" runat="server" Text='<%# Bind("ForeCastQty") %>' BorderStyle="none" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="MinStock">
                                                                <ItemStyle HorizontalAlign="Center" Width="100px" />
                                                                <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblMinStock" runat="server" Text='<%# Bind("MinStock") %>' BorderStyle="none" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="SO Qty">
                                                                <ItemStyle HorizontalAlign="Center" Width="100px" />
                                                                <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblSOQty" runat="server" Text='<%# Bind("SOQty") %>' BorderStyle="none" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="PO Qty">
                                                                <ItemStyle HorizontalAlign="Center" Width="100px" />
                                                                <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblPOQty" runat="server" Text='<%# Bind("POQty") %>' BorderStyle="none" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="InHand">
                                                                <ItemStyle HorizontalAlign="Center" Width="100px" />
                                                                <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblInHand" runat="server" Text='<%# Bind("InHand") %>' BorderStyle="none" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="MRP">
                                                                <ItemStyle HorizontalAlign="Center" Width="100px" />
                                                                <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                                                <ItemTemplate>
                                                                    <asp:Label ID="lblMRP" runat="server" Text='<%# Bind("MRP") %>' BorderStyle="none" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                        </Columns>
                                                        <PagerStyle BackColor="#6095C9" ForeColor="Black" HorizontalAlign="Center" Font-Bold="True" />
                                                        <SelectedRowStyle BackColor="#3399ff" Font-Bold="true" ForeColor="Black" />
                                                        <HeaderStyle BackColor="#cc9900" Font-Bold="true" ForeColor="#ffffff" Font-Overline="False"
                                                            Height="27px" VerticalAlign="Bottom" />
                                                        <EmptyDataTemplate>
                                                            No Data Found.
                                                        </EmptyDataTemplate>
                                                    </asp:GridView>
                                                </asp:Panel>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="#" SortExpression="DocStatus">
                                            <ItemStyle HorizontalAlign="Center" />
                                            <HeaderStyle VerticalAlign="Middle" />
                                            <ItemTemplate>
                                                <asp:Label ID="lblNo" runat="server" Text='<%# Bind("No") %>' BorderStyle="none">
                                                </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Run Date" SortExpression="DocStatus">
                                            <ItemStyle HorizontalAlign="Center" />
                                            <HeaderStyle VerticalAlign="Middle" />
                                            <ItemTemplate>
                                                <asp:Label ID="lblRunDate" runat="server" Text='<%# Bind("RunDate", "{0:dd/MM/yyyy}")%>'
                                                    BorderStyle="none">
                                                </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="From Date" SortExpression="DocStatus">
                                            <ItemStyle HorizontalAlign="Center" />
                                            <HeaderStyle VerticalAlign="Middle" />
                                            <ItemTemplate>
                                                <asp:Label ID="lblFromDate" runat="server" Text='<%# Bind("FromDate", "{0:dd/MM/yyyy}")%>'
                                                    BorderStyle="none">
                                                </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="To Date" SortExpression="DocDate">
                                            <ItemStyle HorizontalAlign="Center" />
                                            <HeaderStyle VerticalAlign="Middle" />
                                            <ItemTemplate>
                                                <asp:Label ID="lblDocDate" runat="server" Text='<%# Bind("ToDate", "{0:dd/MM/yyyy}")%>'
                                                    BorderStyle="none">
                                                </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="ForeCast Code" SortExpression="Comments">
                                            <ItemStyle HorizontalAlign="Left" />
                                            <HeaderStyle VerticalAlign="Middle" />
                                            <ItemTemplate>
                                                <asp:Label ID="lblComments" runat="server" Text='<%# Bind("ForeCastCode") %>' BorderStyle="none">
                                                </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Scenario Name" SortExpression="DocStatus">
                                            <ItemStyle HorizontalAlign="Left" />
                                            <HeaderStyle VerticalAlign="Middle" />
                                            <ItemTemplate>
                                                <asp:Label ID="lblScenarioName" runat="server" Text='<%# Bind("ScenarioName") %>'
                                                    BorderStyle="none">
                                                </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Remark" SortExpression="DocStatus">
                                            <ItemStyle HorizontalAlign="Left" />
                                            <HeaderStyle VerticalAlign="Middle" />
                                            <ItemTemplate>
                                                <asp:Label ID="lblDocStatus" runat="server" Text='<%# Bind("Remarks") %>' BorderStyle="none">
                                                </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                    <PagerStyle BackColor="#6095C9" ForeColor="Black" HorizontalAlign="Center" Font-Bold="True" />
                                    <SelectedRowStyle BackColor="#3399ff" Font-Bold="true" ForeColor="Black" />
                                    <HeaderStyle BackColor="#6095C9" Font-Bold="true" ForeColor="#ffffff" Font-Overline="False"
                                        Height="27px" VerticalAlign="Bottom" />
                                    <EmptyDataTemplate>
                                        No Data Found.
                                    </EmptyDataTemplate>
                                </asp:GridView>
                            </td>
                        </tr>
                    </table>
                </div>
                <div>
                    <table id="tblFooter" width="100%" style="font-weight: bold">
                        <tr>
                            <td>
                                <asp:Timer ID="Timer1" runat="server" Interval="1" OnTick="Timer1_Tick" />
                                <%--<asp:Button ID="btnAccept" runat="server" Text="Close" Style="background-image: url('/Images/bgButton.png');
                                    background-repeat: no-repeat;" Width="80px" OnClientClick="window.close();"/>--%>
                            </td>
                        </tr>
                    </table>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>
